#ifndef OCCURRENCESHIGHLIGHTING_H_INCLUDED
#define OCCURRENCESHIGHLIGHTING_H_INCLUDED

#include <wx/wxprec.h>
#include <set>
#include <M_Code_plugin.h>

class Highlighter;
class OccurrencesPanel;

class OccurrencesHighlighting : public M_Code_Plugin {
  public:
    OccurrencesHighlighting();
    virtual ~OccurrencesHighlighting();
    virtual void BuildModuleMenu( const ModuleType type, wxMenu* menu, const FileTreeData* data = 0 );
    virtual bool BuildToolBar( wxToolBar* toolBar ) { return false; }
    virtual cbConfigurationPanel* GetConfigurationPanel( wxWindow* parent );
    virtual int GetConfigurationPriority() const { return 50; }
    virtual int GetConfigurationGroup() const { return cgEditor; }
  protected:
    virtual void OnAttach();
    virtual void OnRelease( bool appShutDown );
  private:
    void OnListKeyDown( wxListEvent &event );
  private:
    void OnViewOccurrencesPanel( wxCommandEvent& event );
    void OnUpdateViewMenu( wxUpdateUIEvent &event );
    void OnHighlightPermanently( wxCommandEvent &event );
    void OnHighlightRemove( wxCommandEvent &event );
    void OnRemove( wxCommandEvent &event );
    void OnPanelPopupMenu( wxContextMenuEvent &event );
    void OnEditorHook( M_Code_Editor* editor, wxScintillaEvent& event );
  private:
    wxString GetWordAtCaret()const;
    void RemoveSelected();
    void UpdatePanel();
  private:
    int m_FunctorId;
    Highlighter *m_pHighlighter;
    OccurrencesPanel *m_pPanel;
    wxMenu* m_pViewMenu;
    std::set<wxString> m_texts;
  private:
    DECLARE_EVENT_TABLE();
};

#endif
